﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Smtp_server
{
    public partial class Settings : Form
    {
        private ILogger ilogger;
        private DBagent dbagent;

        public Settings(ILogger ilogger, DBagent dbagent)
        {
            InitializeComponent();
            this.ilogger = ilogger;
            this.dbagent = dbagent;
        }

        private void btnLogs_Click(object sender, EventArgs e)
        {
            this.ilogger.Clear();
        }

        private void btnEmail_Click(object sender, EventArgs e)
        {
            dbagent.Clear();
        }

        private void btnConfirm_Click(object sender, EventArgs e)
        {
            Macros.enableSms = this.checkBox1.Checked;
            Macros.enableRelay = this.checkBox2.Checked;
            if (Macros.enableRelay == true && txtIP.Text != "") {
                Macros.server_relay = txtIP.Text;
                Macros.port_relay = Convert.ToInt32(txtPort.Text);
            }
        }

        private void Settings_Load(object sender, EventArgs e)
        {
            if (Macros.enableSms)
                this.checkBox1.Checked=true;
            if (Macros.enableRelay)
                this.checkBox2.Checked=true;
        }



       


    }
}